<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box{
            width: 74px;
            height: 88px;
            border:1px solid #ccc;
            margin: 100px auto;
            font-size: 12px;
            color: #f40;
            text-align: center;
            position: relative;
            
        }
        .box img{
            width: 60px;
            margin-top: 5px;
        }
        .close-btn{
            width: 14px;
            height: 54px;
            border: 1px solid #ccc;
            font-family: Arial;
            line-height: 14px;
            position: absolute;
            top:-1px;
            left:-16px;
            cursor: pointer;  
        }
      
        .img{
            width: 60px;
            height: 60px;
            margin-top: 10px;
            }

    </style>
</head>
<body>
    <div class="box">
     <div class="chiled">
        京东
        <img src="./image/img1.jpg"  class="img"/>
     </div>
        <i class="close-btn">点击关闭</i>
       
    </div>
<script>
    //获取事件源
    var btn = document.querySelector('.close-btn');
    var box = document.querySelector('.box');

    // 仅点击btn元素有效
    // btn.onclick = function(){
    //     box.style.display = 'none'
    // }

    // 点击div元素都有效
    btn,onclick = function(){
        btn.parentNode.style.display = 'none';//隐藏事件
    }


</script>

</body>
</html>